/*******************************************************************************
* Copyright (c) 2010, 2018 西安秦晔信息科技有限公司
* Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*******************************************************************************/
package com.qinyeit.serviceapp.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.qinyeit.serviceapp.entity.enums.PaymentType;
import com.qinyeit.serviceapp.entity.enums.State;
import lombok.Builder;
import lombok.experimental.Tolerate;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

/**
 * ClassName: Payment <br/>
 * Function: 支付方式 <br/>
 * date: 2018-12-03 09:59:02 <br/>
 *
 * @author liuwenjin
 * @version  1.0
 * @since JDK 1.8
 */
@Builder
@Entity
@Table(name="payments")
public class Payment extends MerchantGroupBaseEntity<Long> {

	private static final long serialVersionUID = 1L;

	// 支付名称 
    @Column(name="name", length = 300)
	private String name = null;

	// 支付类型 
    @Column(name="type", length = 300)
	@Enumerated(EnumType.STRING)
	private PaymentType type = PaymentType.BANKCARD;

	// 会员消费是否积分 
    @Column(name="integral")
	private Boolean integral = true;

	// 是否用于会员重置 
    @Column(name="recharge")
	private Boolean recharge = true;

	// 其他参数 
    @Column(name="params", columnDefinition = "mediumtext")
	private String params = null;

	// 状态 
    @Column(name="state", length = 300)
	@Enumerated(EnumType.STRING)
	private State state = State.NORMAL;

	// 操作人 
    @Column(name="operator_name", length = 300)
	private String operatorName = null;

	// 操作日期 
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
    @Column(name="operate_time")
	private Date operateTime = null;

	//是否可以删除默认可以 true 能删除 false 不能删除
	@Column(name="delete_able")
	private Boolean deleteAble = true;


	//创建的时候生成 编辑的时候不变
	@Column(name="uuid", length = 300)
	private String uuid = "";

	//更新的时间戳 long
	@Column(name="update_timestamp")
	private Long updateTimestamp = null;

	@Transient
	private String branchs= "";


    @Tolerate
	public Payment() {
		
	}
    @Tolerate
	public Payment(Long id){
    	super.setId(id);
    }
	
	/**
	 * 获取支付名称
	 */
	public String getName() {
		return this.name;
	}

    /**
     * 设置支付名称
     */
	public Payment setName(String name) {
		this.name = name;
		return this;
	}


	/**
	 * 获取会员消费是否积分
	 */
	public Boolean getIntegral() {
		return this.integral;
	}

    /**
     * 设置会员消费是否积分
     */
	public Payment setIntegral(Boolean integral) {
		this.integral = integral;
		return this;
	}

	/**
	 * 获取是否用于会员重置
	 */
	public Boolean getRecharge() {
		return this.recharge;
	}

    /**
     * 设置是否用于会员重置
     */
	public Payment setRecharge(Boolean recharge) {
		this.recharge = recharge;
		return this;
	}

	/**
	 * 获取其他参数
	 */
	public String getParams() {
		return this.params;
	}

    /**
     * 设置其他参数
     */
	public Payment setParams(String params) {
		this.params = params;
		return this;
	}

	/**
	 * 获取操作人
	 */
	public String getOperatorName() {
		return this.operatorName;
	}

    /**
     * 设置操作人
     */
	public Payment setOperatorName(String operatorName) {
		this.operatorName = operatorName;
		return this;
	}

	/**
	 * 获取操作日期
	 */
	public Date getOperateTime() {
		return this.operateTime;
	}

    /**
     * 设置操作日期
     */
	public Payment setOperateTime(Date operateTime) {
		this.operateTime = operateTime;
		return this;
	}

	public PaymentType getType() {
		return type;
	}

	public void setType(PaymentType type) {
		this.type = type;
	}

	public State getState() {
		return state;
	}

	public void setState(State state) {
		this.state = state;
	}

	public String getBranchs() {
		return branchs;
	}

	public void setBranchs(String branchs) {
		this.branchs = branchs;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public Long getUpdateTimestamp() {
		return updateTimestamp;
	}

	public void setUpdateTimestamp(Long updateTimestamp) {
		this.updateTimestamp = updateTimestamp;
	}

	public Boolean getDeleteAble() {
		return deleteAble;
	}

	public void setDeleteAble(Boolean deleteAble) {
		this.deleteAble = deleteAble;
	}
}
